package cn.hx.mallorder.controller;

import cn.hx.mallorder.dao.OmsOrderItemDao;
import cn.hx.mallorder.entity.OmsOrder;
import cn.hx.mallorder.entity.OmsOrderItem;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class ChargebacksController {
    @Resource
    private OmsOrderItemDao omsOrderItemDao;

    @GetMapping("chargebacks")
    public String chargebacks(Model model) {
        model.addAttribute("orderItems",
                omsOrderItemDao.selectList(new QueryWrapper<OmsOrderItem>().eq("order_id", 12)));
        model.addAttribute("orderId", 12);
        return "chargebacks";
    }

    @PostMapping("chargebacksCommit")
    @ResponseBody
    public String chargebacksCommit(String reason) {
        return null;
    }
}
